﻿using MediatR;
using RBAC.LuFang.API.Application.Command.RoleCommand;
using RBAC.LuFang.Domain;
using RBAC.LuFang.Domin.Services;
using static Microsoft.EntityFrameworkCore.DbLoggerCategory;

namespace RBAC.LuFang.API.Application.CommandHandlers.RoleHandler
{
    public class RoleSelectCommandHandler : IRequestHandler<RoleSelectCommand, Page>
    {
        private readonly IRoleService _roleService;

        public RoleSelectCommandHandler(IRoleService roleService)
        {
            _roleService = roleService;
        }

        public async Task<Page> Handle(RoleSelectCommand request, CancellationToken cancellationToken)
        {
            return await _roleService.GetAllRoles(request.pageindex, request.pagesize,request.rname);
        }
    }
}
